<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        h3 {
            padding: 20px 10px;
        }

        li {
            list-style: none;
        }

        .list li {
            line-height: 45px;
            text-indent: 10px;
            border: 1px solid #333;
        }

        .list li+li {
            border-top: 0;
        }
    </style>
</head>

<body>
    <div class="wrap">
        <h3 id="title">批量操作元素</h3>
        <div class="list">
            <li>01</li>
            <li>02</li>
            <li>03</li>
            <li>04</li>
            <li>05</li>
            <li>06</li>
        </div>
    </div>
</body>
<script>
    /* var eles = document.querySelectorAll(".list li");

    var operateHtml = {
        eles,
        setHtml: function (con) {
            for (var i = 0; i < eles.length; i++) {
                var ele = eles[i];
                ele.innerHTML = con;
            }
        },
        getHtml: function(){
            return eles[0].innerHTML;
        }
    }
    operateHtml.setHtml(666); */

    var getHtml = {
        eles: document.querySelectorAll(".list li"),
        html: function (con) {
            if (arguments.length >= 1) {//有至少一个参数
                for (var i = 0; i < this.eles.length; i++) {
                    var ele = this.eles[i];
                    ele.innerHTML = con;
                }
            }else{
                return this.eles[0].innerHTML;
            }
        }
    }
    getHtml.html(6666);
    console.log(getHtml.html());
</script>

</html>